package rauguelu.programaEventos;


import rauguelu.feria.tapas.tapasVinos;
import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;
import android.widget.TabHost.OnTabChangeListener;

public class FestivalSentidosTab extends TabActivity  {
    /** Called when the activity is first created. */

    
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        Resources res = getResources(); // Resource object to get Drawables
        final TabHost tabHost = getTabHost();  // The activity TabHost
        TabHost.TabSpec spec;  // Resusable TabSpec for each tab
        Intent intent;  // Reusable Intent for each tab
        
        
        intent = new Intent().setClass(this, Portada.class);

        spec = tabHost.newTabSpec("artists").setIndicator("Inicio",
                          res.getDrawable(R.drawable.ic_tab_songs))
                      .setContent(intent);
        tabHost.addTab(spec);

        intent = new Intent().setClass(this, ProgramaEventos.class);
        spec = tabHost.newTabSpec("albums").setIndicator("Agenda",
                          res.getDrawable(R.drawable.ic_tab_agenda))
                      .setContent(intent);
        tabHost.addTab(spec);

        intent = new Intent().setClass(this, tapasVinos.class);
        spec = tabHost.newTabSpec("songs").setIndicator("Tapas & Vinos",
                          res.getDrawable(R.drawable.ic_tab_degusta))
                      .setContent(intent);
        tabHost.addTab(spec);
        
        intent = new Intent().setClass(this, feedTweet.class);
        spec = tabHost.newTabSpec("songs").setIndicator("Comenta",
                          res.getDrawable(R.drawable.ic_tab_comenta))
                      .setContent(intent);
        tabHost.addTab(spec);
        
        intent = new Intent().setClass(this, MasInfoMenu.class);
        spec = tabHost.newTabSpec("songs").setIndicator("Más Info",
                          res.getDrawable(R.drawable.ic_tab_masinfo))
                      .setContent(intent);
        tabHost.addTab(spec);

        
        
        for(int i=0;i<tabHost.getTabWidget().getChildCount();i++)  
        {  
            tabHost.getTabWidget().getChildAt(i).setBackgroundResource(R.drawable.tab_bg_unselected);  
        }  
        tabHost.setCurrentTab(0);
        tabHost.getTabWidget().getChildAt(0).setBackgroundResource(R.drawable.tab_bg_selected); 
        
        tabHost.setOnTabChangedListener(new OnTabChangeListener(){
            @Override
            public void onTabChanged(String tabId) {
            	
                 for(int i=0;i<tabHost.getTabWidget().getChildCount();i++)
                    {
                     tabHost.getTabWidget().getChildAt(i).setBackgroundResource(R.drawable.tab_bg_unselected); //unselected
                    }
                    tabHost.getTabWidget().getChildAt(tabHost.getCurrentTab()).setBackgroundResource(R.drawable.tab_bg_selected); // selected
            }});

    }
}